package com.ljd.music.service.impl;

import com.ljd.music.dao.SongMapper;
import com.ljd.music.pojo.Song;
import com.ljd.music.service.SongService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SongServiceImpl implements SongService {

    @Autowired
    private SongMapper songMapper;

    @Override
    public boolean insert(Song song) {
        return songMapper.insert(song) > 0;
    }

    @Override
    public boolean update(Song song) {
        return songMapper.update(song) > 0;
    }

    @Override
    public boolean delete(Integer id) {
        return songMapper.delete(id) > 0;
    }

    @Override
    public boolean deleteSongs(List<String> songIds) {
        return songMapper.deleteSongs(songIds) > 0;
    }

    @Override
    public Song selectByPrimaryKey(Integer id) {
        return songMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Song> allSong() {
        return songMapper.allSong();
    }

    @Override
    public List<Song> selectSongOfName(String name) {
        return songMapper.selectSongOfName(name);
    }

    @Override
    public List<Song> selectSongOfSingerId(Integer singerId) {
        return songMapper.selectSongOfSingerId(singerId);
    }
}
